{include file='header'/}
<body class="pear-admin">
<form class="layui-form" action="{:url('auth_rule/add')}">
    <div class="mainBox">
        <div class="main-container">
            <div class="layui-form-item">
                <label class="layui-form-label required">{:__('AuthRuleParent')}</label>
                <div class="layui-input-block">
                    <select name="pid" lay-verify="" lay-search>
                        <?php
                        foreach($pidList as $key=>$v){
                        ?>
                        <option value="<?php echo $v['id'] ?>"
                        <?php if($v['id'] == $id) echo "selected"; ?>><?php echo $v['title'] ?></option>
                        <?php } ?>
                    </select>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label required">{:__('AuthRuleType')}</label>
                <div class="layui-input-block">
                    <select name="type" lay-verify="" lay-search>
                        <option value="0" selected>{:__('Dir')}</option>
                        <option value="1">{:__('Page')}</option>
                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label required">{:__('IsMenu')}</label>
                <div class="layui-input-block">
                    <input type="radio" name="is_menu" value="1" title="{:__('Yes')}">
                    <input type="radio" name="is_menu" value="0" title="{:__('No')}" checked>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">{:__('AuthRuleIcon')}</label>
                <div class="layui-input-block">
                    <input type="text" name="icon" id="iconPicker2" value="" lay-filter="iconPicker2">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label required">{:__('AuthRuleTitle')}</label>
                <div class="layui-input-block">
                    <div class="layui-input-group">
                        <input type="text" name="title" placeholder="{:__('PleaseEnter %s',[__('AuthRuleTitle')])}" class="layui-input"
                               value="" lay-verify="required">
                    </div>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label required">{:__('AuthRuleNode')}</label>
                <div class="layui-input-block">
                    <input type="text" name="node" id="node" lay-verify="required" autocomplete="off"
                           placeholder="{:__('PleaseEnter %s',[__('AuthRuleNode')])}"
                           class="layui-input" value="">
                </div>
                <tip>{:__('Please Fill In The Complete Path Address')}</tip>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">{:__('Sort')}</label>
                <div class="layui-input-block">
                    <input type="number" name="sort" id="sort" lay-verify="required" autocomplete="off"
                           placeholder="{:__('PleaseEnter %s',[__('Sort')])}"
                           class="layui-input" value="100">
                </div>
                <tip>【{:__('SortByAsc')}】</tip>
            </div>
        </div>
    </div>
    <div class="bottom">
        <div class="button-container">
            <input type="hidden" name="__token__" value="{:token()}"/>
            <button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit=""
                    lay-filter="admin-save">
                <i class="layui-icon layui-icon-ok"></i>
                {:__('Add')}
            </button>
            <button type="reset" class="pear-btn pear-btn-sm">
                <i class="layui-icon layui-icon-refresh"></i>
                {:__('Reset')}
            </button>
        </div>
    </div>
</form>
{include file='footer'/}
<script>
  layui.use(['form', 'jquery', 'iconPicker'], function () {
    let form = layui.form;
    let $ = layui.jquery;
    let iconPicker = layui.iconPicker;

    iconPicker.render({
      elem: '#iconPicker2',
      type: 'fontClass',
      style: 'color: #5FB878;',
      placeholder: '',
      isSplit: true,
      search: true,
      page: false,
      limit: 16,
    });
  })
</script>
